#include <iostream>

using namespace std;

int main()
{
    int A,B,C = 0;
    cout << "A = "; cin >> A;
    cout << "B3333 = ";cin >> B;
    while((C+B) <= A)
    {
        C = C+B;
    }
    cout << A-C <<  "\n";
    return 0;
}
